# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AndroidPublisher.V3.Model.SubscriptionOfferPhase do
  @moduledoc """
  A single phase of a subscription offer.

  ## Attributes

  *   `duration` (*type:* `String.t`, *default:* `nil`) - Required. The duration of a single recurrence of this phase. Specified in ISO 8601 format.
  *   `otherRegionsConfig` (*type:* `GoogleApi.AndroidPublisher.V3.Model.OtherRegionsSubscriptionOfferPhaseConfig.t`, *default:* `nil`) - Pricing information for any new locations Play may launch in.
  *   `recurrenceCount` (*type:* `integer()`, *default:* `nil`) - Required. The number of times this phase repeats. If this offer phase is not free, each recurrence charges the user the price of this offer phase.
  *   `regionalConfigs` (*type:* `list(GoogleApi.AndroidPublisher.V3.Model.RegionalSubscriptionOfferPhaseConfig.t)`, *default:* `nil`) - Required. The region-specific configuration of this offer phase. This list must contain exactly one entry for each region for which the subscription offer has a regional config.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :duration => String.t() | nil,
          :otherRegionsConfig =>
            GoogleApi.AndroidPublisher.V3.Model.OtherRegionsSubscriptionOfferPhaseConfig.t() | nil,
          :recurrenceCount => integer() | nil,
          :regionalConfigs =>
            list(GoogleApi.AndroidPublisher.V3.Model.RegionalSubscriptionOfferPhaseConfig.t())
            | nil
        }

  field(:duration)

  field(:otherRegionsConfig,
    as: GoogleApi.AndroidPublisher.V3.Model.OtherRegionsSubscriptionOfferPhaseConfig
  )

  field(:recurrenceCount)

  field(:regionalConfigs,
    as: GoogleApi.AndroidPublisher.V3.Model.RegionalSubscriptionOfferPhaseConfig,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.AndroidPublisher.V3.Model.SubscriptionOfferPhase do
  def decode(value, options) do
    GoogleApi.AndroidPublisher.V3.Model.SubscriptionOfferPhase.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AndroidPublisher.V3.Model.SubscriptionOfferPhase do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
